Skip to content

security: codemender 2026 12 05 - #2551

Merged
petr-sandbox merged 27 commits into
mainfrom
security/codemender-2026-12-05
Dec 6, 2026
Merged

petr-sandbox merged 27 commits into
mainfrom
security/codemender-2026-12-05

Conversation

@petr-sandbox

@petr-sandbox petr-sandbox commented Dec 6, 2026 •

Copy link
Copy Markdown
Collaborator

Security fixes from an automated code-scanning pass, plus fixes from reviewing them. Fixes that also landed on main separately (Windows spawn escaping, the decision service's client cache, systemd credentials, the gateway origin check, OIDC account linking, the support-request rate limit) were merged in favour of main's version, so they are no longer part of this diff.

Tenant isolation

  • Messaging identities: ExternalUserStore filters lookups of external users, their claims and their link requests by the bound tenant. The verify, cancel and release identity endpoints return 404 when the bridge or the identity belongs to another workspace. An admin who cancels or releases a link for someone outside the workspace also gets 404.
  • Pending attachment groups: the router's expiry sweep and its flush are scoped to the room's tenant, so one tenant's sweep can't take another tenant's group.
  • Agent my_context: the workspace member count counts only the agent's own workspace instead of every tenant's members.

Injection and escaping

  • Slack: a request's "closed, though the host called it …" outcome and its unavailable reason are escaped and capped in length in cards and footers (in both the neutral and Slack renderers).
  • Slack file fetches: https only, port 443, a well-formed hostname, no backslashes, whitespace or control characters, and an exact match on slack.com or slack-gov.com or a subdomain.
  • Webex: defused raw mentions use an explicit zero-width space, and render_mentions doesn't turn them back into mentions.
  • SSH exec: the stdout marker and the command are joined with && instead of ;.
  • Gateway channel links: only http(s) and the known messaging-app schemes are linked. Any other link logs a warning, and openChannelLink throws an error that its caller shows.

Robustness

  • Box launcher link: a connection that never says hello is dropped after the silence timeout, so it can't hold the launcher's single slot. That doesn't count as losing the launcher: the state stays waiting and nothing logs launcher_lost.
  • Telemetry: a refused property value is no longer written into the validation message, which gets logged.
  • ensure_default_workspace: re-reads the organization row once it holds the lock (populate_existing).
  • Hosted Terraform: a new plan test asserts that worker egress is exactly tcp/80 and tcp/443. The worker security group still has no inline egress, and the IMDSv2 deny keeps StringNotEquals: the PR's first versions of both were reverted, because they made the egress rules flap between applies and let a launch without metadata options skip the deny.

CI fixes for failures inherited from main

  • Account deletion with organizations: stops calling the RLS-exempt tenants_of_organization and stops opening an unbound session. It finds the organization holding the default workspace by reading that workspace's own row, and reads the account's WorkOS user ids through PurgeElsewhere. Results are unchanged. A new test checks that the default workspace's organization is never offered.
  • Free Beta dialog (dashboard): uses "Switch" and "device" instead of the retired "server" and "machine".
  • Get started test: the test that uses Finish later now runs on a test server, which is the only place that button is offered now.
  • E2E browser lane: the browser driver clicks Next on the team survey, which is now split in two.

Tests

New or extended tests cover cross-tenant access to the identity endpoints, attachment-group scoping, Slack and Webex escaping, workspace allowance and default-workspace concurrency, the launcher link, and channel links. Checked locally: core gateway, collaboration, delivery, telemetry and store suites (11,939 passed), decision (540), the touched console and gateway suites, terraform test, ruff and mypy.

🤖 Generated with Claude Code

p15r-sb and others added 27 commits December 5, 2026 08:00
- Terraform: keep worker egress on the standalone rules only (inline
  egress = [] stripped them every other apply) and restore the IMDSv2
  deny to StringNotEquals.
- windows-spawn: refuse only %VAR% references; a lone % is caret-escaped.
- decision: drop evicted Anthropic clients instead of closing them under
  in-flight requests.
- launcher-link: a connection that never says hello is dropped without
  reporting the launcher lost.
- workspace_creation: remove the no-op read=False and its comments.
- channelLinks: a refused channel link warns or raises instead of doing
  nothing.
- collaborations: make bridge_store required and run the bridge, tenant
  and membership checks unconditionally.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…026-12-05

# Conflicts:
#	console/packages/agent-controller/src/systemd-runtime.test.ts
#	console/packages/agent-controller/src/systemd-runtime.ts
#	console/packages/shared/src/windows-spawn.test.ts
#	console/packages/shared/src/windows-spawn.ts
#	core/switch_core/db/stores/user_store.py
#	core/switch_core/gateway/origin_check.py
#	core/tests/switch_core/gateway/test_origin_check.py
#	core/tests/switch_core/gateway/test_support_requests.py
#	decision/switch_decision/backends.py
#	decision/tests/test_api.py
#	gateway/src/data/channelLinks.test.ts
#	gateway/src/data/channelLinks.ts
- Account deletion with organizations no longer reaches the RLS-exempt
  tenant lookup or opens an unbound session. The organization holding the
  default workspace is found by reading that workspace's own row, and the
  account's WorkOS user ids are read through PurgeElsewhere, which already
  reads oidc_identities on its own session. Same results as before; adds a
  test that the default workspace's organization is never offered.
- Gateway: the Free Beta copy uses "Switch" and "device" instead of the
  retired "server" and "machine".
- Gateway: Finish later on Get started is offered only on test servers, so
  the Free Beta test that uses it runs on one.
- E2E browser lane: the team survey is split in two; click Next before the
  use cases.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@petr-sandbox
petr-sandbox marked this pull request as ready for review December 6, 2026 06:57
@petr-sandbox
petr-sandbox merged commit 100770d into main Dec 6, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants